package Observers;

import java.util.Random;

/**
 * <p>Title RandomNumberGenerator</p>
 *
 * @author YiMing Liu
 * @date 2018/6/14 16:34
 * <p>Description:</p>
 */
public class RandomNumberGenerator extends NumberGenerator {

    private Random random = new Random();
    private int number;

    @Override
    public int getNubmer() {
        return number;
    }

    @Override
    public void execute() {
        for (int i = 0; i < 20; i++) {
            number = random.nextInt(50);
            notifyObserver();
        }
    }
}
